//package com.plian.system.controller.dg;
//
//import com.plian.Tools.base.BaseController;
//import com.plian.system.config.Resubmit;
//import com.plian.system.constant.sys.FormTypeConstant;
//import com.plian.system.entity.dg.EnterpriseAssociation;
//import com.plian.system.model.CommonCode;
//import com.plian.system.model.ListResult;
//import com.plian.system.model.R;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.mybatis.support.Query;
//import com.plian.system.service.dg.IChangeAssociationService;
//import com.plian.system.service.dg.IEnterpriseAssociationService;
//import com.plian.system.vo.dg.EnterpriseAssociationVO;
//import com.plian.system.wrapper.dg.EnterpriseAssociationWrapper;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.AllArgsConstructor;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.validation.Valid;
//
///**
// * @Description: TODO
// * @Author: Take-off
// * @Date: 2023/4/4 5:14 PM
// * @Param
// * @return
// * @Version: 1.0
// **/
//@RestController
//@AllArgsConstructor
//@RequestMapping("api/enterpriseassociation")
//@Api(value = "EnterpriseAssociationController", tags = "企业章程文件 控制器")
//public class EnterpriseAssociationController extends BaseController {
//
//    private final IChangeAssociationService changeAssociationService;
//
//    private final IEnterpriseAssociationService enterpriseAssociationService;
//
//    private final EnterpriseAssociationWrapper enterpriseAssociationWrapper;
//
//    @PostMapping("/detail")
//    @ApiOperation(value = "详情", notes = "传入 enterpriseAssociation")
//    public R<EnterpriseAssociationVO> detail(@RequestBody EnterpriseAssociation enterpriseAssociation) {
//        EnterpriseAssociation detail = enterpriseAssociationService.getOne(Condition.getQueryWrapper(enterpriseAssociation));
//        EnterpriseAssociationVO enterpriseAssociationVO = enterpriseAssociationWrapper.entityToVO(detail);
//        if (enterpriseAssociationVO.getFormType().equals(FormTypeConstant.DG_ENTERPRISE_ASSOCIATION_CHANGE + "")){
//            //变更详情，加上上个版本的详情
//           enterpriseAssociationVO.setLastInfoVO(
//                    enterpriseAssociationWrapper.entityToVO(enterpriseAssociationService.getById(enterpriseAssociationVO.getLastVersionId()))
//            );
//        }
//        return R.data(enterpriseAssociationVO);
//    }
//
//    @PostMapping("/list")
//    @ApiOperation(value = "分页", notes = "传入query")
//    public ListResult<EnterpriseAssociationVO> list(@RequestBody Query query) {
//
//        return enterpriseAssociationService.list(query);
//    }
//
//    @PostMapping("/submit-change")
//    @Resubmit(delaySeconds = 0)
//    @ApiOperation(value = "新增或修改-变更信息", notes = "传入 enterpriseAssociation")
//    public R<EnterpriseAssociation> submitChange(@Valid @RequestBody EnterpriseAssociation enterpriseAssociation) {
//        boolean result = changeAssociationService.submit(enterpriseAssociation);
//        return result ? R.data(enterpriseAssociation) : new R(CommonCode.FAIL);
//    }
//
//    @PostMapping("/version-list")
//    @ApiOperation(value = "查看版本", notes = "传入 initialId")
//    public ListResult<EnterpriseAssociationVO> versionList(@RequestBody Query query) {
//        return enterpriseAssociationService.versionList(query);
//    }
//}
